package survivalcraft.common;



import net.minecraft.src.Block;
import net.minecraft.src.BlockLeaves;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EnumToolMaterial;
import net.minecraft.src.GameSettings;
import net.minecraft.src.Item;
import net.minecraft.src.ItemAxe;
import net.minecraft.src.ItemStack;
import net.minecraft.src.RenderGlobal;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;


@Mod(modid = "SurvivalCraft", name = "SurvivalCraft", version = "1.4.5-151")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class SurvivalCraft {
	
	
	@Init
	public void load(FMLInitializationEvent event) {

		BlockCampFire campFireIdle = new BlockCampFire(getUnusedBlockID(), false);
		campFireIdle.setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setBlockName("campFire").setRequiresSelfNotify().setCreativeTab(CreativeTabs.tabDecorations);
		GameRegistry.registerBlock(campFireIdle);
		LanguageRegistry.addName(campFireIdle, "CampFire");
		GameRegistry.addRecipe(new ItemStack(campFireIdle), " s ", "sss", "ddd", 'd', new ItemStack(Block.dirt), 's', new ItemStack(Item.stick));
		
		BlockCampFire campFireActive = new BlockCampFire(getUnusedBlockID(), true);
		campFireActive.setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setLightValue(0.875F).setBlockName("campFire").setRequiresSelfNotify();
		GameRegistry.registerBlock(campFireActive);

		Block.blocksList[Block.leaves.blockID] = null;
		BlockStickLeaves stickLeaves = new BlockStickLeaves(Block.leaves.blockID, 52);
		stickLeaves.setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setBlockName("leaves").setRequiresSelfNotify();
		stickLeaves.setGraphicsLevel(true);
		GameRegistry.registerBlock(stickLeaves);
		
		Item axeFlint = new ItemAxe(getUnusedItemID(), EnumToolMaterial.STONE).setIconCoord(1, 7).setItemName("hatchetFlint");
		GameRegistry.addRecipe(new ItemStack(axeFlint), "sf", "s ", 'f', new ItemStack(Item.flint), 's', new ItemStack(Item.stick));
		axeFlint.setMaxDamage(3);
		
		GameRegistry.registerTileEntity(TileEntityCampFire.class, "TileEntityCampFire");
	
		GlobalModifications.modifyToolEffectiveness();
		
		GameRegistry.addShapelessRecipe(new ItemStack(Item.silk, 4), new Object[] {Block.cloth});
		
	}
	
	private int getUnusedItemID() {
		int nextUnusedItemID = 1;
		while(net.minecraft.src.ItemAnvilBlock.itemsList[nextUnusedItemID] != null) 
			nextUnusedItemID++;
		return nextUnusedItemID;
	}

	private int getUnusedBlockID() {
		int nextUnusedBlockID = 1;
		while(net.minecraft.src.Block.blocksList[nextUnusedBlockID] != null) 
			nextUnusedBlockID++;
		return nextUnusedBlockID;
	}

}
